<%@ page language="java" contentType="text/html; charset=GBK"
    pageEncoding="GBK"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>set user's permission</title>
</head>

<script type="text/javascript">
	function saveUserTypes(){
		var url="<%=request.getContextPath()%>/login.do?method=saveUserTypes&userCode=${userCode }";
		fm.action = url;
		fm.submit();
	}
</script>

<body>
	<form action="login.do" name="UserTaskForm" method="post">
		<table width="100%" cellpadding="5" cellspacing="1" border="1">
			<tr>
				<td colspan="4" align="center"><b>set user's permission</b></td>
			</tr>
			<tr>
				<td><B>user code </B></td>
				<td><b>${userCode }</b></td>
				<td><B>user name</B></td>
				<td>${userName }</td>
			</tr>
		</table>
		<table width="100%" cellpadding="5" cellspacing="1" border="1">
			<tr>
				<td colspan="4" align="center"><b>user competence list</b></td>
			</tr>
			<tr>
				<td align="center"><B>competence code</B></td>
				<td align="center"><B>competence name</B></td>
				<td align="center"><B>competence code</B></td>
				<td align="center"><B>competence name</B></td>
			</tr>
			<c:set var="index" value="0" />
			<c:forEach items="${Tasks }" var="one">
				<c:if test="${index % 2 == 0}">
					<tr>
				</c:if>
				<td>
					<c:choose>
						<c:when test="${one.taskSelected == '1'}">
							<input type="checkbox" name="boxes" value='${one.taskCode}:${one.taskName }' checked>
						</c:when>
						<c:otherwise>
							<input type="checkbox" name="boxes" value='${one.taskCode}:${one.taskName }'>
						</c:otherwise>
					</c:choose>
					${one.taskCode }
				</td>
				<td>${one.taskName }</td>
				<c:if test="${index % 2 == 1}">
					</tr>
				</c:if>
				<c:set var="index" value="${index + 1}"></c:set>
			</c:forEach>
			<c:if test="${index % 2 == 1}">
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				</tr>
			</c:if>
		</table>
		<br>
		<table width="100%" cellpadding="5" cellspacing="1">
			<tr>
				<td align="center"><input type="button" name="but" value="save" onclick="saveUserTypes('${param.userCode }')"></td>
			</tr>
		</table>
	</form>
</body>
<script type="text/javascript">
	var fm = UserTaskForm;
</script>
</html>